package org.gongliang.jsmile.config.excel;

import org.gongliang.jsmile.config.excel.filter.ExcelFilter;

@SuppressWarnings("rawtypes")
public class ImportParams {

	public static ImportParams init(String... columns) {
		return new ImportParams(columns);
	}

	public ImportParams() {

	}

	public ImportParams(String... columns) {
		if (columns != null && columns.length > 0) {
			this.columns = columns;
		}
	}

	// 有几行文件头，默认为1
	private int headerRow = 1;
	/*
	 * 表头的中文字段对应的英文
	 */
	private String[] columns;
	// excel过滤器
	private ExcelFilter filter;

	/*
	 * 默认读取第一个sheet
	 */
	private int sheetNum = 0;

	public int getHeaderRow() {
		return headerRow;
	}

	public void setHeaderRow(int headerRow) {
		this.headerRow = headerRow;
	}

	public String[] getColumns() {
		return columns;
	}

	public void setColumns(String[] columns) {
		this.columns = columns;
	}

	public ExcelFilter getFilter() {
		return filter;
	}

	public void setFilter(ExcelFilter filter) {
		this.filter = filter;
	}

	public int getSheetNum() {
		return sheetNum;
	}

	public void setSheetNum(int sheetNum) {
		this.sheetNum = sheetNum;
	}

	public ImportParams headerRow(int headerRow) {
		if (headerRow <= 1)
			headerRow = 1;
		this.headerRow = headerRow;
		return this;
	}

	public ImportParams columns(String... columns) {
		this.columns = columns;
		return this;
	}

	public ImportParams filter(ExcelFilter filter) {
		this.filter = filter;
		return this;
	}

	public ImportParams sheetNum(int sheetNum) {
		if (sheetNum <= 1)
			sheetNum = 1;
		this.sheetNum = sheetNum;
		return this;
	}
}
